//The MIT License
//
//Copyright (c) 2009 nodchip
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//
//The above copyright notice and this permission notice shall be included in
//all copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//THE SOFTWARE.
package tv.dyndns.kishibe.client;

import java.util.List;
import java.util.Map;
import java.util.Set;

import tv.dyndns.kishibe.client.game.GameMode;
import tv.dyndns.kishibe.client.packet.PacketBbsResponse;
import tv.dyndns.kishibe.client.packet.PacketBbsThread;
import tv.dyndns.kishibe.client.packet.PacketChatData;
import tv.dyndns.kishibe.client.packet.PacketGameStatus;
import tv.dyndns.kishibe.client.packet.PacketLinkData;
import tv.dyndns.kishibe.client.packet.PacketMatchingPlayer;
import tv.dyndns.kishibe.client.packet.PacketProblemCreationLog;
import tv.dyndns.kishibe.client.packet.PacketProblemData;
import tv.dyndns.kishibe.client.packet.PacketRankingData;
import tv.dyndns.kishibe.client.packet.PacketRatingDistribution;
import tv.dyndns.kishibe.client.packet.PacketRegistrationData;
import tv.dyndns.kishibe.client.packet.PacketResult;
import tv.dyndns.kishibe.client.packet.PacketRoomKey;
import tv.dyndns.kishibe.client.packet.PacketServerStatus;
import tv.dyndns.kishibe.client.packet.PacketUserData;
import tv.dyndns.kishibe.client.packet.PacketWrongAnswer;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.AsyncCallback;

public interface ServiceAsync {
	public void addIgnoreUserCode(int userCode, int targetUserCode, AsyncCallback<?> callback);

	public void addLinkData(PacketLinkData linkData, AsyncCallback<?> callback);

	public void addProblemIdsToReport(int userCode, int[] problemIds, AsyncCallback<?> callback);

	public void addRatingHistory(int userCode, int rating, AsyncCallback<?> callback);

	public void buildBbsThread(PacketBbsThread thread, PacketBbsResponse response, AsyncCallback<?> callback);

	// 問題評価文をクリアする
	public void clearProblemFeedback(int problemId, AsyncCallback<?> callback);

	public void clearProblemIDFromReport(int userCode, AsyncCallback<?> callback);

	public void getAvailableChalactersForHandwriting(AsyncCallback<Set<String>> callback);

	public void getBbsResponses(int threadId, int count, AsyncCallback<PacketBbsResponse[]> callback);

	public void getBbsThread(int start, int count, AsyncCallback<PacketBbsThread[]> callback);

	// イベント部屋情報を取得する
	public void getEventRooms(AsyncCallback<List<PacketRoomKey>> callback);

	// ゲームの進行状態を取得する
	public void getGameStatus(int sessionId, int playerListId, AsyncCallback<PacketGameStatus> callback);

	public void getLinkDatas(int start, int count, AsyncCallback<PacketLinkData[]> callback);

	public void getLoginUsers(AsyncCallback<PacketUserData[]> callback);

	// マッチング中の相手のデータを取得する
	public void getMachingPlayer(int sessionId, AsyncCallback<PacketMatchingPlayer[]> callback);

	public void getNewUserCode(AsyncCallback<Integer> callback);

	public void getNumberOfBbsThreads(AsyncCallback<Integer> callback);

	public void getNumberOfLinkDatas(AsyncCallback<Integer> callback);

	// PlayerHistoryを取得する
	public void getPlayerHistory(AsyncCallback<String[]> callback);

	// 他のプレイヤーの名前を取得する
	public void getPlayerNameList(int sessionId, AsyncCallback<String[]> callback);

	public void getPrefectureRanking(AsyncCallback<int[][]> callback);

	public void getProblemCreationLog(int problemId, AsyncCallback<PacketProblemCreationLog[]> callback);

	public void getProblemData(int sessionId, AsyncCallback<PacketProblemData[]> callback);

	// 問題評価文を取得する
	public void getProblemFeedback(int problemId, AsyncCallback<List<String>> callback);

	// 問題を取得する
	public void getProblemList(List<Integer> problemIds, AsyncCallback<PacketProblemData[]> callback);

	public void getRankingData(AsyncCallback<PacketRankingData[][]> callback);

	public void getRatingDistribution(AsyncCallback<PacketRatingDistribution> callback);

	public void getRatingHistory(int userCode, AsyncCallback<int[]> callback);

	// 結果表示
	// 最終結果を取得する
	public void getResult(int sessionId, AsyncCallback<PacketResult[]> callback);

	// サーバーの状態を取得する
	public void getServerStatus(boolean isFirst, int userCode, AsyncCallback<PacketServerStatus> callback);

	public void getSessionTransition(int sessionId, AsyncCallback<Integer> callback);

	public void getStatisticsOfAccuracyRate(AsyncCallback<int[][]> callback);

	// 問題統計情報を取得する
	public void getStatisticsOfProblemCount(AsyncCallback<int[][]> callback);

	public void getThemeModeRanking(AsyncCallback<Map<String, PacketRankingData[]>> callback);

	public void getThemeModeThemes(AsyncCallback<String[]> callback);

	public void getUserProblemReport(int userCode, AsyncCallback<PacketProblemData[]> callback);

	public void getWrongAnswers(int problemId, AsyncCallback<PacketWrongAnswer[]> callback);

	public void isLimitedUser(int userCode, AsyncCallback<Boolean> callback);

	public void loadUserData(int userCode, AsyncCallback<PacketUserData> callback);

	// チャットからメッセージを受信する
	public void receiveMessageFromChat(int nextArrayIndex, AsyncCallback<PacketChatData[]> callback);

	// 手書き文字の識別を行う
	public void recognizeHandwriting(double[][][] strokes, AsyncCallback<String[]> callback);

	// プレイヤー情報を登録する
	public void register(String name, int genre, int type, String greeting, GameMode gameMode, String roomName, String theme, String imageFileName, int classLevel, int difficultSelect, int rating, int userCode, boolean newProblem, boolean publicEvent, AsyncCallback<PacketRegistrationData> callback);

	public void removeIgnoreUserCode(int userCode, int targetUserCode, AsyncCallback<?> callback);

	public void removeLinkData(int id, AsyncCallback<?> callback);

	// 誤解答を削除する
	public void removePlayerAnswers(int problemID, AsyncCallback<?> callback);

	public void removeProblemIDFromReport(int userCode, int problemId, AsyncCallback<?> callback);

	public void reportLogin(int userCode, AsyncCallback<?> callback);

	// 強制的にゲームをスタートさせる
	public void requestSkip(int sessionId, int playerListId, AsyncCallback<Integer> callback);

	public void saveUserData(PacketUserData userData, AsyncCallback<?> callback);

	// 問題の検索を行う
	public void searchProblem(String query, String creater, int genre, int type, int randomFlag, AsyncCallback<PacketProblemData[]> callback);

	// 類似問題を検索する
	public void searchSimilarProblem(String query, AsyncCallback<PacketProblemData[]> callback);

	// ゲーム
	// 自分の解答を送る
	public void sendAnswer(int sessionId, int playerListId, String answer, AsyncCallback<Boolean> callback);

	// チャットにメッセージを送信する
	public void sendMessageToChat(PacketChatData chatData, AsyncCallback<?> callback);

	public void updateLinkData(PacketLinkData linkData, AsyncCallback<?> callback);

	// 問題を投稿する
	public void uploadProblem(PacketProblemData problemData, int userCode, AsyncCallback<Integer> callback);

	// 投票を行う
	public void voteToProblem(int userCode, int problemId, boolean good, String feedback, AsyncCallback<?> callback);

	// ゲーム開始待機
	public void waitForGame(int sessionId, AsyncCallback<Integer> callback);

	// マッチング 他の対戦者の参加を待つ
	public void waitForMatching(int sessionId, int playerListId, AsyncCallback<Integer> callback);

	public void writeToBbs(PacketBbsResponse response, boolean age, AsyncCallback<?> callback);

	public void getThemeModeQuery(AsyncCallback<Map<String, List<String>>> callback);

	public void addThemeModeQuery(String theme, String query, AsyncCallback<?> callback);

	public void removeThemeModeQuery(String theme, String query, AsyncCallback<?> callback);

	public void isThemeModeEditor(int userCode, AsyncCallback<Boolean> callback);

	public void applyThemeModeEditor(int userCode, String text, AsyncCallback<?> callback);

	public void acceptThemeModeEditor(int userCode, AsyncCallback<?> callback);

	public void rejectThemeModeEditor(int userCode, AsyncCallback<?> callback);

	public void getThemeModeEditors(AsyncCallback<Map<Integer, Integer>> callback);

	public void isApplyingThemeModeEditor(int userCode, AsyncCallback<Boolean> callback);
}
